﻿<script src="/static/js/jquery-2.1.1.js"></script>
<script src="/static/bootstrap/js/bootstrap.js"></script>
<link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<link href="/static/layui/css/layui.css" rel="stylesheet"/>
<script src="/static/layui/layui.js"></script>
<script src="/static/js/yii.js"></script>
<link href="/static/css/pattern/public.css" rel="stylesheet"/>

<style>
    html, body{background-color:#FFF!important;}
    .layui-inline{margin-bottom:15px;display: inline-block}
    .layui-input-block{margin-left:0px!important;}
    .zxd_coordinate{border:1px solid silver;line-height:30px;height:30px;display: inline-block;padding:0px 10px;border-radius:3px;margin:5px;background-color: #0b6fff;color: #fff;position: relative}
    .zxd_contetnt{line-height:30px;padding-right:10px!important;padding-left:10px!important;}
    .zxd_list{display: inline-block;width:100%;line-height:38px;}
    .zxd_list div{background-color:#f5f5f5;margin-bottom:15px;padding:5px 10px;border-radius:4px;display: inline-block;width:100%}

    .zxd_list p{display: inline-block;width:100%}
    .zxd_list span{display:inline-block;text-align: right;font-size:12px;}
    .zxd_list span:last-child{float: right}
    .zxd_history{padding-right:10px!important;padding-left:10px!important;height:300px;display: block;overflow:auto;  }
    .zxd_coordinate font{
        position: absolute;
        top:-5px;border-radius: 20px;
        right:-8px;line-height:20px;height:20px;width: 20px;text-align: center;
        background-color: #FF0000;color: #FFFFFF;
    }
    .show_multiple{float: left;margin-left:15px;}
    #images_upload{display: inline-block;float: left;padding:0px 10px;}
    .images_del{text-align: center}
</style>
<div class="modal-body">

    <!--layui-form-pane-->
    <form class="layui-form layui-form-pane form-horizontal" name="saveForm" action="" >

        <div class="layui-form-item layui-col-md12">
            <label class="layui-form-label">时间</label>
            <div class="input-group col-xs-9" style="float: left">
                <input type="text" name="show_time" value="{$detail.show_time}" class="layui-input test-item" >
            </div>
        </div>

        <div class="layui-form-item layui-col-md12">
            <label class="layui-form-label">内容</label>
            <div class="input-group col-xs-9 " >
                <textarea class="layui-textarea" name="content">{$detail.content}</textarea>
            </div>
        </div>

        <div class="layui-form-item layui-col-md12" style="width:100%">
            <label class="layui-form-label">*图组</label>
            <!--存储上传的图片信息-->
            <div class="layui-input-block">
                <div class="input-group">
                    <div id="images_upload" ><img src="/static/images/upload.jpeg" style="width:100px;height:100px;"></div>
                    <div class="input-group show_multiple row">
                        {volist name="$detail['images']" id="vo1"}
                        <div class="newimg"><img src="{$vo1}" ><input type="hidden" name="images[]" value="{$vo1}"><div class="images_del" >删除</div></div>
                        {/volist}
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-form-item layui-col-md12">
            <label class="layui-form-label">审核操作</label>
            <div class="input-group col-xs-9 " >
                <input type="radio" name="status" value="1" title="通过" {if condition="$detail['status'] eq 1"} checked {/if} >
                <input type="radio" name="status" value="2" title="驳回" {if condition="$detail['status'] eq 2"} checked {/if}>
            </div>
        </div>


        <input type="hidden" name="pro_id" value="{$detail.pro_id}">
        <input type="hidden" name="id" value="{$detail.id}">
    </form>

</div>
<script>

    var newModal = new yii.modal();
    $(".show_multiple").on("click",".images_del",function () {
        $(this).parent().remove();
    })
    //多图片上传
    $("#images_upload").click(function () {
        $(newModal.getid()).show();
        newModal.initialization({
            url: "{:URL('common/Upload/index')}",
            type: "post",
            data:{
                type:'detail',
                multiple:'multiple'
            }
        });
    });

    newModal.on("multiple",function(data){
        var images = '';
        $(newModal.getid()).find("#data-area .newimages .active img").each(function () {
            images += '<div class="newimg"><img src="'+$(this).attr('src')+'" ><input type="hidden" name="images[]" value="'+$(this).attr('src')+'"><div class="images_del" >删除</div></div>';
        })
        $(newModal.getid()).hide();
        //遮罩层隐藏
        //$('#nowMainProjectDataForm').modal('hide');
        $(".modal-backdrop").remove();
        $(newModal.getid()).find(".modal").hide();
        $(".show_multiple").append(images);
    });
    //多图上传



    layui.use(['form', 'laydate','upload'], function () {
        var form = layui.form;
        var laydate = layui.laydate;
        var detail = "{:URL('project/Help/addPersonnel')}";

        $(".addPersonnel").click(function () {
            var showUrl =  "{:URL('project/Help/addPersonnel')}";
            showView(showUrl,"详情");
        });

        //删除协助人员
        $(".del").click(function (e) {
            $(this).parent().remove();
        });

        //同时绑定多个
        lay('.test-item').each(function(){
            laydate.render({
                elem: this
                ,trigger: 'click'
                ,type: 'date'
            });
        });

        function showView(showUrl,type){
            layer.open({
                type: 2,
                skin: 'layui-layer-demo', //样式类名
                area: ['450px','400px'],            //宽度450px,高自适应
                anim: 2,
                shadeClose: false, //开启遮罩关闭,
                maxmin: true,
                title: type,
                content:showUrl,
                btn:['添加','关闭'],
                yes: function (index,layero) {
                    var body = layer.getChildFrame('body', index);
                    var data = body.find("form[name='accountForm']").serializeArray();
                    $.ajax({
                        type: "post",
                        url: "/project/help/doPersonnel",
                        data: data,
                        dataType: "json",
                        success: function (res) {
                            layer.alert(res.msg);
                            if(res.code==0){
                                $(".addPersonnelView").append(res.html);
                            }
                        }
                    });
                    // data.push({name: "plan_id", value: plan_id});
                },
            });
        }

    });
</script>